
#import "AppDelegate.h"

@implementation AppDelegate

-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    [self setupTabBar];

    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
    
    [[UITabBar appearance] setTintColor:kNavBarTintColor];
    [[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
    [[UINavigationBar appearance] setBarTintColor:kNavBarTintColor];
    [[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor]}];
    
    self.window.rootViewController = self.tabBarController;
    [self.window makeKeyAndVisible];
    return YES;
}

-(void)setupTabBar {
    UITabBar *tabBar = self.tabBarController.tabBar;
    
    NSArray *tabNames = @[@"hitta_lampan", @"inred_med_ljus", @"omvandla", @"mer_upplysning"];
    
    for (NSInteger n = 0; n < tabBar.items.count; n++) {
        NSString *tabName = tabNames[n];
        UITabBarItem *tabBarItem = tabBar.items[n];
        
        tabBarItem.selectedImage = [[UIImage imageNamed:[NSString stringWithFormat:@"ic_meny_%@_on", tabName]]
                                     imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
        tabBarItem.image = [[UIImage imageNamed:[NSString stringWithFormat:@"ic_meny_%@_off", tabName]]
                             imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    }
}

@end
